loop-counter rule — bilateral narrowing, missing counter resets, ERROR promotion#4196
Merged
Trecek merged 3 commits intoJul 7, 2026
Conversation
…-counter-not-reset-on-outer-cycle - Add _WRAPPER_LOOP_EXEMPT_COUNTERS frozenset to exempt group_iteration_count (run-wide safety ceiling) from the cross-cycle reset requirement - Promote severity from WARNING to ERROR (matches the rule's role as a blocking gate against starvation) - Restructure rule body: swap loop order to (outer, inner), hoist forward_reachable BFS out of inner loop, add cycle_candidates precomputed via ctx.predecessors for bilateral cycle-membership check - forward_reachable.add(non_exit_target) compensates for bfs_reachable's start-node exclusion so the direct-target case is not silently skipped - Bilateral check structurally excludes post-audit terminal guards (CI watch, stall recovery) that lack a path back to the audit-remediation outer guard Add reset_merge_test_fix_counter and reset_ref_push_counter steps to remediation.yaml, implementation.yaml, and implementation-groups.yaml so each audit-remediation cycle gets fresh merge-gate fix and ref-push budgets. implementation-groups.yaml uses its existing double-quoted style. Update tests/recipe/test_rules_loop_counter.py with new TestLoopCounterNotResetOnOuterCycle class covering: missing reset fires, reset present suppresses, post-audit terminal excluded by bilateral check, group_iteration_count exempt counter excluded, and parametrized bundled-recipe zero-findings assertion across all three recipes. Update tests/recipe/test_rules_integration_predicate.py: _load_recipes now also loads implementation-groups.yaml; method renamed from test_both_recipes_no_error_semantic_findings to test_all_recipes_no_error_semantic_findings and iteration extended to include the third recipe. Regenerate pre-compiled JSON (.json siblings) via task compile-recipes which also regenerates contract cards via regen-contracts dependency. Update embedded SHA-256 hashes in recipes/diagrams/*.md to match the new YAML content.
…_reset_present_does_not_fire Route test step on_success back to outer_guard instead of done, forming the cycle required by the bilateral narrowing check. Without this, the bilateral check correctly excluded the inner guard (no path back to outer), producing 0 findings instead of the expected 1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Trecek
commented
Jul 7, 2026
Trecek
left a comment
Collaborator
Author
There was a problem hiding this comment.
AutoSkillit review passed. No blocking issues found.
…ne width The new counter-reset chain (audit_impl → reset_test_fix_counter → reset_merge_test_fix_counter → reset_ref_push_counter → remediate) exceeded the 120-character line width limit enforced by test_show_cook_preview_line_width_bounded_with_implementation_recipe. Wrap the chain onto two lines in all three recipe diagrams. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix three defects in the
loop-counter-not-reset-on-outer-cyclesemantic rule, add missing counter-reset steps to the three bundled audit recipes, promote the rule to ERROR severity, and add comprehensive test coverage.Rule defects (in
src/autoskillit/recipe/rules/rules_loop_counter.py):group_iteration_count, a run-wide safety ceiling that must not be reset per-cycle. Fix: add a documented exempt-counter constant.Recipe gaps (in all three bundled audit recipes):
merge_test_fix_loop_countis never reset between audit-remediation cycles — starvation risk identical to thetest_fix_loop_countbug fixed in Run 4 of #3987: POSIX-ERE tests under Python re + no per-cycle fix budget #4192. Fix: addreset_merge_test_fix_counterstep.ref_push_countis never reset — same starvation class. Fix: addreset_ref_push_counterstep.Test gaps: No
TestLoopCounterNotResetOnOuterCycletest class exists.test_both_recipes_no_error_semantic_findingsomits implementation-groups.Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260706-185104-926367/.autoskillit/temp/make-plan/loop_counter_bilateral_narrowing_plan_2026-07-06_192500.mdCloses #4194
🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown